package cn.dankal.basiclib.api;

import android.annotation.TargetApi;

import java.util.List;
import java.util.Map;

import androidx.annotation.AnyRes;
import cn.dankal.annotations.ApiFactory;
import cn.dankal.basiclib.pojo.BaseListResponse;
import cn.dankal.basiclib.pojo.BaseResponse;
import cn.dankal.basiclib.pojo.CouponEntity;
import cn.dankal.basiclib.pojo.ProductEntity;
import cn.dankal.basiclib.pojo.req.ExchangeReq;
import io.reactivex.Observable;
import retrofit2.http.Body;
import retrofit2.http.Field;
import retrofit2.http.FormUrlEncoded;
import retrofit2.http.GET;
import retrofit2.http.POST;
import retrofit2.http.Query;
import retrofit2.http.QueryMap;

/**
 * <pre>
 *     e-mail : junfeng.nie@duntech.com.cn
 *     time   : 12/7/2020
 *     desc   :
 *     version: cn.dankal.basiclib.api
 *     Copyright: Copyright（c）2018
 *     Company:
 * </pre>
 *
 * @author niejunfeng
 */
@ApiFactory(value = BaseApiByShop.class)
public interface MyCardService {

    //我的优惠券列表

    @GET("frontapi/coupons")
    Observable<BaseResponse<List<CouponEntity>>> cardList(@QueryMap Map<String,
            Object> params);

    //使用优惠券
    @POST("frontapi/coupons/pay")
    @FormUrlEncoded
    Observable<BaseResponse<Object>> couponsPay(@Field("userCouponUuid") String userCouponUuid);

    //券码兑换优惠券
    @GET("frontapi/coupons/exchange")
    Observable<BaseResponse<CouponEntity>> couponsExchange(@Query("code")String code);

    //发放优惠券红包
    @POST("frontapi/coupons/transfer")
    @FormUrlEncoded
    Observable<BaseResponse<String>> couponsExchange(@Field("userCouponUuid") String userCouponUuid,
                                                           @Field("userUuid") String userUuid);
    //发放优惠券红包群聊
    @POST("frontapi/coupons/transfer-to-group")
    @FormUrlEncoded
    Observable<BaseResponse<String>> couponsExchangeByGroup(@Field("userCouponUuid") String userCouponUuid,
                                                     @Field("gid") String gid);

    //领取优惠券红包
    @POST("frontapi/coupons/accept")
    @FormUrlEncoded
    Observable<BaseResponse<Object>> getCoupon(@Field("transferOrderUuid") String userCouponUuid);


}
